package rabbit;

import java.util.Date;
import java.util.UUID;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Senders {
	
    @Autowired
    private RabbitTemplate  rabbitTemplate;
    public void send(Object message) {
        String context = "hello " + new Date();
        System.out.println("Sender : " + context);
        String uuid = UUID.randomUUID().toString();
        CorrelationData correlationId = new CorrelationData(uuid);
        rabbitTemplate.convertAndSend(RabbitMQConfiguration.TEST_EXCHANGE_NAME, RabbitMQConfiguration.ROUTING_KEY, message,
                correlationId);
    }
}